home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / program / misc / gencodee.lha / E / Localized_DemoGenCodeE / GUI.e < prev    next >
Text File  |  1995-09-12  |  8KB  |  231 lines

  1. OPT MODULE
  2. OPT PREPROCESS
  3.  
  4.  
  5. ->/////////////////////////////////////////////////////////////////////////////
  6. ->//////////////////////////////////////////////////////////// MODULE ... /////
  7. ->/////////////////////////////////////////////////////////////////////////////
  8. MODULE 'muimaster' , 'libraries/mui'
  9. MODULE 'tools/boopsi' , 'libraries/gadtools'
  10. MODULE 'utility/tagitem' , 'utility/hooks'
  11.  
  12. MODULE '*Locale'
  13.  
  14.  
  15. ->/////////////////////////////////////////////////////////////////////////////
  16. ->//////////////////////////////////////////////////////////// OBJECT ... /////
  17. ->/////////////////////////////////////////////////////////////////////////////
  18. EXPORT OBJECT app_arexx
  19.     commands :    PTR TO mui_command
  20.     error    :    hook
  21. ENDOBJECT
  22.  
  23. EXPORT OBJECT app_display
  24.     button_pressed          :    hook
  25. ENDOBJECT
  26.  
  27. EXPORT OBJECT app_obj
  28.     app                     :    PTR TO LONG
  29.     wi_the_window           :    PTR TO LONG
  30.     bt_put_constant_string  :    PTR TO LONG
  31.     bt_put_variable         :    PTR TO LONG
  32.     bt_return_id            :    PTR TO LONG
  33.     bt_call_hook            :    PTR TO LONG
  34.     tx_result               :    PTR TO LONG
  35.     bt_quit                 :    PTR TO LONG
  36.     stR_TX_result           :    PTR TO CHAR
  37. ENDOBJECT
  38.  
  39.  
  40. ->/////////////////////////////////////////////////////////////////////////////
  41. ->/////////////////////////////////////////////////////// CONST ... = ... /////
  42. ->/////////////////////////////////////////////////////////////////////////////
  43. EXPORT ENUM
  44.     ID_BUTTON_PRESSED = 1
  45.  
  46.  
  47. ->/////////////////////////////////////////////////////////////////////////////
  48. ->///////////////////////////////////////////////////////// DEF ... = ... /////
  49. ->/////////////////////////////////////////////////////////////////////////////
  50. EXPORT DEF string_var
  51.  
  52. EXPORT DEF cat : PTR TO catalog_DemoGenCodeE
  53.  
  54.  
  55. ->/////////////////////////////////////////////////////////////////////////////
  56. ->/////////////////////////////////////////////////////////// PROC create /////
  57. ->/////////////////////////////////////////////////////////////////////////////
  58. PROC create( display : PTR TO app_display ,
  59.              icon  = NIL ,
  60.              arexx = NIL : PTR TO app_arexx ,
  61.              menu  = NIL ) OF app_obj
  62.  
  63.     DEF grOUP_ROOT_0C , gr_grp_0 , gr_grp_1 , la_result , gr_grp_2
  64.  
  65.     self.stR_TX_result           := cat.msg_TX_result.getstr()
  66.  
  67.     self.bt_put_constant_string := TextObject ,
  68.         ButtonFrame ,
  69.         MUIA_Background , MUII_ButtonBack ,
  70.         MUIA_ControlChar , Char( cat.msg_BT_put_constant_string.getstr() ) ,
  71.         MUIA_Text_Contents , getMBstring( cat.msg_BT_put_constant_string.getstr() ) ,
  72.         MUIA_Text_PreParse , '\ec' ,
  73.         MUIA_Text_HiChar , Char( cat.msg_BT_put_constant_string.getstr() ) ,
  74.         MUIA_HelpNode , 'BT_put_constant_string' ,
  75.         MUIA_InputMode , MUIV_InputMode_RelVerify ,
  76.     End
  77.  
  78.     self.bt_put_variable := TextObject ,
  79.         ButtonFrame ,
  80.         MUIA_Background , MUII_ButtonBack ,
  81.         MUIA_ControlChar , Char( cat.msg_BT_put_variable.getstr() ) ,
  82.         MUIA_Text_Contents , getMBstring( cat.msg_BT_put_variable.getstr() ) ,
  83.         MUIA_Text_PreParse , '\ec' ,
  84.         MUIA_Text_HiChar , Char( cat.msg_BT_put_variable.getstr() ) ,
  85.         MUIA_HelpNode , 'BT_put_variable' ,
  86.         MUIA_InputMode , MUIV_InputMode_RelVerify ,
  87.     End
  88.  
  89.     self.bt_return_id := SimpleButton( getMBstring( cat.msg_BT_return_id.getstr() ) )
  90.  
  91.     self.bt_call_hook := TextObject ,
  92.         ButtonFrame ,
  93.         MUIA_Background , MUII_ButtonBack ,
  94.         MUIA_ControlChar , Char( cat.msg_BT_call_hook.getstr() ) ,
  95.         MUIA_Text_Contents , getMBstring( cat.msg_BT_call_hook.getstr() ) ,
  96.         MUIA_Text_PreParse , '\ec' ,
  97.         MUIA_Text_HiChar , Char( cat.msg_BT_call_hook.getstr() ) ,
  98.         MUIA_HelpNode , 'BT_call_hook' ,
  99.         MUIA_InputMode , MUIV_InputMode_RelVerify ,
  100.     End
  101.  
  102.     la_result := Label( getMBstring( cat.msg_LA_result.getstr() ) )
  103.  
  104.     self.tx_result := TextObject ,
  105.         MUIA_HelpNode , 'TX_result' ,
  106.         MUIA_Background , MUII_TextBack ,
  107.         MUIA_Frame , MUIV_Frame_Text ,
  108.         MUIA_Text_Contents , self.stR_TX_result ,
  109.         MUIA_Text_PreParse , '\el' ,
  110.         MUIA_Text_SetMin , MUI_TRUE ,
  111.     End
  112.  
  113.     gr_grp_1 := GroupObject ,
  114.         MUIA_Group_Horiz , MUI_TRUE ,
  115.         Child , la_result ,
  116.         Child , self.tx_result ,
  117.     End
  118.  
  119.     gr_grp_0 := GroupObject ,
  120.         MUIA_Frame , MUIV_Frame_Group ,
  121.         MUIA_FrameTitle , getMBstring( cat.msg_GR_grp_0Title.getstr() ) ,
  122.         Child , self.bt_put_constant_string ,
  123.         Child , self.bt_put_variable ,
  124.         Child , self.bt_return_id ,
  125.         Child , self.bt_call_hook ,
  126.         Child , gr_grp_1 ,
  127.     End
  128.  
  129.     self.bt_quit := TextObject ,
  130.         ButtonFrame ,
  131.         MUIA_Background , MUII_ButtonBack ,
  132.         MUIA_ControlChar , Char( cat.msg_BT_quit.getstr() ) ,
  133.         MUIA_Text_Contents , getMBstring( cat.msg_BT_quit.getstr() ) ,
  134.         MUIA_Text_PreParse , '\ec' ,
  135.         MUIA_Text_HiChar , Char( cat.msg_BT_quit.getstr() ) ,
  136.         MUIA_HelpNode , 'BT_quit' ,
  137.         MUIA_InputMode , MUIV_InputMode_RelVerify ,
  138.     End
  139.  
  140.     gr_grp_2 := GroupObject ,
  141.         Child , self.bt_quit ,
  142.     End
  143.  
  144.     grOUP_ROOT_0C := GroupObject ,
  145.         Child , gr_grp_0 ,
  146.         Child , gr_grp_2 ,
  147.     End
  148.  
  149.     self.wi_the_window := WindowObject ,
  150.         MUIA_Window_Title , getMBstring( cat.msg_WI_the_window.getstr() ) ,
  151.         MUIA_HelpNode , 'WI_the_window' ,
  152.         MUIA_Window_ID , "0WIN" ,
  153.         WindowContents , grOUP_ROOT_0C ,
  154.     End
  155.  
  156.     self.app := ApplicationObject ,
  157.         ( IF icon THEN MUIA_Application_DiskObject ELSE TAG_IGNORE ) , icon ,
  158.         ( IF arexx THEN MUIA_Application_Commands ELSE TAG_IGNORE ) , ( IF arexx THEN arexx.commands ELSE NIL ) ,
  159.         ( IF arexx THEN MUIA_Application_RexxHook ELSE TAG_IGNORE ) , ( IF arexx THEN arexx.error ELSE NIL ) ,
  160.         ( IF menu THEN MUIA_Application_Menu ELSE TAG_IGNORE ) , menu ,
  161.         MUIA_Application_Author , 'Lionel Vintenat' ,
  162.         MUIA_Application_Base , 'DEMOGENCODEE' ,
  163.         MUIA_Application_Title , 'DemoGenCodeE' ,
  164.         MUIA_Application_Version , '$VER: DemoGenCodeE 1.0 (01.09.94)' ,
  165.         MUIA_Application_Copyright , getMBstring( cat.msg_AppCopyright.getstr() ) ,
  166.         MUIA_Application_Description , getMBstring( cat.msg_AppDescription.getstr() ) ,
  167.         SubWindow , self.wi_the_window ,
  168.     End
  169.  
  170. ENDPROC self.app
  171.  
  172.  
  173. ->/////////////////////////////////////////////////////////////////////////////
  174. ->////////////////////////////////////////////////////////// PROC dispose /////
  175. ->/////////////////////////////////////////////////////////////////////////////
  176. PROC dispose() OF app_obj IS ( IF self.app THEN Mui_DisposeObject( self.app ) ELSE NIL )
  177.  
  178.  
  179. ->/////////////////////////////////////////////////////////////////////////////
  180. ->/////////////////////////////////////////////// PROC init_notifications /////
  181. ->/////////////////////////////////////////////////////////////////////////////
  182. PROC init_notifications( display : PTR TO app_display ) OF app_obj
  183.  
  184.     domethod( self.bt_put_constant_string , [
  185.         MUIM_Notify , MUIA_Pressed , FALSE ,
  186.         self.tx_result ,
  187.         3 ,
  188.         MUIM_Set , MUIA_Text_Contents , getMBstring( cat.msg_BT_put_constant_stringNotify0.getstr() ) ] )
  189.  
  190.     domethod( self.bt_put_variable , [
  191.         MUIM_Notify , MUIA_Pressed , FALSE ,
  192.         self.tx_result ,
  193.         3 ,
  194.         MUIM_Set , MUIA_Text_Contents , string_var ] )
  195.  
  196.     domethod( self.bt_return_id , [
  197.         MUIM_Notify , MUIA_Pressed , FALSE ,
  198.         self.app ,
  199.         2 ,
  200.         MUIM_Application_ReturnID , ID_BUTTON_PRESSED ] )
  201.  
  202.     domethod( self.bt_call_hook , [
  203.         MUIM_Notify , MUIA_Pressed , FALSE ,
  204.         self.app ,
  205.         2 ,
  206.         MUIM_CallHook , display.button_pressed ] )
  207.  
  208.     domethod( self.bt_quit , [
  209.         MUIM_Notify , MUIA_Pressed , FALSE ,
  210.         self.app ,
  211.         2 ,
  212.         MUIM_Application_ReturnID , MUIV_Application_ReturnID_Quit ] )
  213.  
  214.     domethod( self.wi_the_window , [
  215.         MUIM_Window_SetCycleChain , self.bt_put_constant_string ,
  216.         self.bt_put_variable ,
  217.         self.bt_return_id ,
  218.         self.bt_call_hook ,
  219.         self.bt_quit ,
  220.         0 ] )
  221.  
  222.     set( self.wi_the_window ,MUIA_Window_Open , MUI_TRUE )
  223.  
  224. ENDPROC
  225.  
  226.  
  227. ->/////////////////////////////////////////////////////////////////////////////
  228. ->////////////////////////////////////////////////////// PROC getMBstring /////
  229. ->/////////////////////////////////////////////////////////////////////////////
  230. PROC getMBstring( local_string : PTR TO CHAR ) RETURN ( IF local_string[ 1 ] = "\0" THEN ( local_string + 2 ) ELSE local_string )
  231.